package net.pluce.nxt.network;

/**
 * Thread listening to the robot connection and sending events when it receives messages
 * Once started, the thread should read the connection input stream and keep informed the listeners.<br>
 * The thread should terminate when the stream is closed, and will raise an error flag if it's closed because of an error. Use <code>getErrorFlag()</code> to get this error.
 * @author Pluce
 */
public interface EventWatcher extends Runnable{

	/**
	 * Return the error flag raised after stream termination.
	 * @return an error or null if no error happened.
	 */
	public abstract Throwable getErrorFlag();

	public abstract void run();

	/**
	 * Sets the connection to the robot
	 * @param robotConnection
	 */
	public abstract void setRobotConnection(RobotConnection robotConnection);

}